package com.yoshon.yoshonapp.expandlistview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ExpandableListView;

/**
 * Created by Administrator on 2016/8/12.
 */
public class PullToExpandableListView extends ExpandableListView implements Pullable{
    public PullToExpandableListView(Context context) {
        super(context);
    }

    public PullToExpandableListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public PullToExpandableListView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean canPullDown() {
        if (getCount() == 0) {
            return true;
        } else if (getFirstVisiblePosition() == 0
                && getChildAt(0).getTop() >= 0) {
            return true;
        } else
            return false;
    }

    @Override
    public boolean canPullUp() {
            return false;
    }
}
